<template>
  <div class="about">
    <h1>This is an about page</h1>
  </div>
</template>
<script>
import { Base64 } from "js-base64";
export default {
  data() {
    return {
      msg: "我是大圣--yyy",
      arr: [
        { id: 1, name: "111" },
        { id: 2, name: "222" },
        { id: 1, name: "333" },
      ],
    };
  },
  mounted() {
    // 加密
    let str = Base64.encode(this.msg);
    console.log(str);
    // 解密
    console.log(Base64.decode(str));
    this.filterArr();
    
  },
  methods: {
    // 数组对象去重
    filterArr() {
      let newArr = [];
      this.arr.forEach((item) => {
        if (!newArr.some((val) => val.id === item.id)) {
          newArr.push(item);
        }
      });
      console.log(newArr);
      
    },
  },
  destroyed() {},
};
</script>
